import {
	Controller,
	Get,
	Post,
	Body,
	Patch,
	Param,
	Delete,
	Query,
} from "@nestjs/common";
import { UserService } from "./user.service";
import { CreateUserDto } from "./dto/create-user.dto";
import { Public } from "@/common/decorators/public.decorator";
import { UpdateUserDto } from "./dto/update-user.dto";

@Controller("user")
export class UserController {
	constructor(private readonly userService: UserService) {}

	@Public()
	@Post("register")
	register(@Body() createUserDto: CreateUserDto) {
		return this.userService.register(createUserDto);
	}

	@Get("findUserById")
	findUserById(@Query("id") id: string) {
		return this.userService.findUserById(+id);
	}

	@Get("getOpenidList")
	getOpenidList(@Query("names") names: string) {
		return this.userService.getOpenidList(names);
	}

	@Post("updateUser")
	updateUser(@Body() updateUserDto: UpdateUserDto) {
		return this.userService.updateUser(updateUserDto);
	}
}
